<div class="titlebar"><i class="iconfont icon-license"></i>权限认证</div>  
<form id="form" action="{:url('store/add')}">
<input type="hidden" name="img" id="img_index" />
<table class="formtable">
    <tr><th>二维码编码:</th>
        <td>
            <input autocomplete="off" class="input" type="text" name="code_id" datatype="n6-18" ajaxurl="{:url('store/codeid')}" />
            <span class="gray">12位数字(6位城市邮编+6位随机编号),<a class="blue" href="https://developers.weixin.qq.com/miniprogram/introduction/qrcode.html" target="_blank">怎么设置付款码？</a></span>
        </td>
    </tr>
    <tr><th>好店店长:</th>
        <td>
            <input readonly="readonly" id="manage_uid" class="readonly input w100" type="text" name="manage_uid" value="0" />
            <button url="{:url('allwin/store/selectStoreManage')}" data="manage_uid" type="button" class="selectPopup button"><i class="iconfont icon-my_icon"></i>选择用户</button>
        </td>
    </tr>
    <tr><th>服务费:</th>
        <td>
            <input autocomplete="off" class="input w100" datatype="n" type="text" name="charges" /> ‰
            <span class="gray">如果商家有[交易服务费]将免去[支付费率]</span>
        </td>
    </tr>
    {if $member_miniapp.is_psp}
    <tr><th>商户号:</th>
        <td>
            <input readonly="readonly" id="mch_id" class="readonly input w100" type="text" name="mch_id" value="0"/>
            <button url="{:url('allwin/mchid/selectMchid',['input' => 'mch_id'])}" type="button" class="selectPopup button"><i class="iconfont icon-chuzhijine"></i>商户号</button>
            <button type="button" class="button rem_mch"><i class="iconfont icon-reduce_icon"></i>取消</button>
            <span class="gray">商户号[必须是服务商体系下的子商户]</span>
        </td>
    </tr>
    {/if}
</table> 
<div class="titlebar"><i class="iconfont icon-store_icon"></i>好店信息</div>  
<table class="formtable">
    <tr><th>行业分类:</th><td>
        <select id="cate_id" class="select w200" datatype="*" name="cate_id" class="select">
        <option value="">--请选择行业--</option>
        {foreach $cate as $vo}<option value="{$vo.id}">{$vo.name}</option>{/foreach}
        </select>
        <select id="cate_sid" class="select w200" name="cate_sid" class="select"></select>
    </td></tr>
    <tr><th>商家名称:</th><td><input autocomplete="off" class="input w400" datatype="*" type="text" name="name" /></td></tr>
    <tr><th>商家地址:</th><td>
        <input autocomplete="off" class="input w400" datatype="*" type="text" name="address" value="" />
        <p class="gray"><i class="iconfont icon-address_icon"></i>地址请包含<span class="red">省市地区</span>完整地址,方便位置定位判断</p>
    </td></tr>
    <tr><th>经纬度:</th><td>
        <input readonly="true" autocomplete="off" class="input w150 readonly" datatype="*" type="text" name="longitude" value="" />
        <input readonly="true" autocomplete="off" class="input w150 readonly" datatype="*" type="text" name="latitude" value="" />
        <button type="button" class="button button-green lib"><i class="iconfont icon-address_icon"></i>读取经纬</button>
    </td></tr>
    <tr><th>电话:</th><td><input autocomplete="off" class="input" datatype="*" type="text" name="telphone" value="" /></td></tr>
    <tr><th>标语与公告:</th><td><input autocomplete="off" class="input w400" datatype="byterange" max="50" type="text" name="tips" value="" /></td></tr>
    <tr><th>商家优势:</th><td><input class="input w400" type="text" name="tags" /> <span class="gray">每个关键字以<span class="fn-fb red">逗号( , )</span>分开</span></td></tr>
    <tr>
        <th>商家图片</th>
        <td id="imgbox">
            <div class="box-view fn-left fn-cp selectPopup" url="{:url('system/passport.common/upload')}"></div>
        </td>
    </tr>
    <tr>
        <th></th>
        <td>
            <input type="submit" value="确定" class="button button-blue submit" />
            <input type="reset" value="重置" class="button button-blank"/>
        </td>
    </tr>
</table>
</div>
</form>
<script id="cate" type="text/html">
    {{each list value}}
        <option value="{{value.id}}">{{value.name}}</option>
    {{/each}}
</script> 
<script type="text/javascript">
Do('base','layer','form','date','tpl',function () {
    $('#form').isForm();
    $(".selectPopup").win();
    $(".lib").click(function () {
        var val = $("input[name='address']").val();
        if(val == "" || val == null || val == undefined){
            parent.layer.alert('好店地址必须填写');
        }else{
            $(this).popup({'url':'{:url("allwin/store/baidu")}?address='+val,area: ['60%','550px']});
        }
    });
    $(".rem_mch").click(function(){$("#mch_id").val('0');});
    $("#cate_id").change(function(){
        var cate_id = $(this).val();
        $.getJSON('{:url("allwin/store/storecate")}',{cate_id: cate_id},function (rel) {
            $("#cate_sid").html(template('cate',{list:rel.data}));
        });
    });
})
function setPoint(point){
    $("input[name='longitude']").val(point.lng);
    $("input[name='latitude']").val(point.lat);
}
</script>